package tests;

import common.Utils;
import org.openqa.selenium.By;

public class QuestionCenterPage extends Utils {
    public static String url =detailUrl;
    public QuestionCenterPage() {
        super(url);
    }
    //点击题库中心，出现下拉框，然后挨个检查页面
    public void checkQuestionCenterpage() throws InterruptedException {
        //点击题库中心
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > aside > div > div:nth-child(1) > ul > li:nth-child(4)")).click();
        //点击题库中心的下拉框的我的题库
        driver.get("http://49.235.61.184:8080/repo/index");
        //检查我的题库页面中的元素是否存在
        //检查名称搜索框、类型栏、查询和重置按钮是否存在
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter"));
        //检查名称和搜索框是否存在
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(1)"));
        //检查类型栏是否存在
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(2)"));
        //检查重置按钮是否存在
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(1) > button"));
        //检查查询按钮是否存在
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter > form > div > div:nth-child(3) > div > div > div.ant-col.ant-form-item-control > div > div > div > div > div > div:nth-child(2) > button"));
        //检查题库列表是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div"));
        System.out.println("题库中心，我的题库页面检查通过");

        //点击下拉框的问题管理
        driver.get("http://49.235.61.184:8080/repo/template");
        //检查问题管理的状态狂是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-table-search.ant-pro-table-search-query-filter"));
        //检查试卷列表的状态框是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div:nth-child(2) > div"));
        System.out.println("题库中心，问题管理页面检查通过");

        //查看我的笔记页面
        driver.get("http://49.235.61.184:8080/repo/book");
        //检查我的错题和我的收藏是否可见
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-page-header.ant-pro-page-container-warp-page-header.ant-pro-page-container-warp-page-header.ant-page-header-has-breadcrumb.ant-page-header-has-footer.ant-page-header-ghost > div.ant-page-header-footer > div > div.ant-tabs-nav > div.ant-tabs-nav-wrap"));
        //检查状态栏是否正确显示
        driver.findElement(By.cssSelector("#sk-layout > div > div > section > div.ant-pro-layout-container > main > div > div.ant-pro-grid-content > div > div > div > div.ant-pro-card.ant-pro-card-border.ant-pro-card-bordered.ant-pro-table-search.ant-pro-table-search-query-filter"));
        System.out.println("题库中心，我的笔记页面检查通过");
    }

}
